<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ page isELIgnored="false"%>
<%@ include file="../common/taglibs.jsp"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>POS收单运营管理平台</title>
<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="expires" content="0">
<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
<meta http-equiv="description" content="This is my page">
<link href="<s:url value="/css/common.css"/>" type="text/css" rel="stylesheet" />
<script type="text/javascript"
	src="<c:url value="/js/jquery-1.3.2.js" />"></script>
<script type="text/javascript" src="<c:url value="/js/common.js" />"></script>
<script language="javascript" type="text/javascript"
	src="<c:url value="/js/My97DatePicker/WdatePicker.js"/>"></script>
<script type='text/javascript' src='<s:url value="/dwr/engine.js"/>'></script>
<script type='text/javascript' src='<s:url value="/dwr/interface/MccQuery.js"/>'></script>
<script type="text/javascript">
	function freezeImportSubmit(dealType){
		$("#dealType").val('');
		$("#dealType").val(dealType);
		var flag;
		var excelFile = $.trim($("#excelFile").val());
		if(!excelFile){
			alert("请选择要上传的文件");
			return false;
		}
		var suffix = excelFile.substring(excelFile.lastIndexOf(".")+1);
		if("xlsx" != suffix){
			alert("请上传后缀名为xlsx的文件");
			return false;
		}
		if(dealType=='0'){
			flag='冻结';
		}else if(dealType=='1'){
			flag='解冻';
		}else if(dealType=='2'){
			flag='注销';
		}else if(dealType=='3'){
			flag='开通';
		}
		if(confirm("请确认是否要进行商户批量"+flag+"操作")){
			$("#batchFreezeImportForm").attr("action","<%=basePath%>/mer/fileImpUpdate.ct");
			$("#batchFreezeImportForm").submit();
			$("#imptFrzeMerinfoBtn").attr("disabled",true);
			$("#imptUnFrzeMerinfoBtn").attr("disabled",true);
			$("#imptportCalMerinfoBtn").attr("disabled",true);
		}else{
		    return;
		}
	}
	
	function showMould() {
		
		if($("#upFileExp").css("display")=="block"){
			$("#upFileExp").css("display",'none');
        }else{
        	$("#upFileExp").css("display",'block');
        }
	} 
	function change32(){
		var upload = $.trim($("#upload").val());
		if(!upload){
			alert("请选择要上传的文件");
			return false;
		}
		var suffix = upload.substring(upload.lastIndexOf(".")+1);
		if("xlsx" != suffix){
			alert("请上传后缀名为xlsx的文件");
			return false;
		}
		
		$("#batchFreezeImportForm").attr("action","<%=basePath%>/change32And43/importChange32List.ct");
		$("#batchFreezeImportForm").submit();
		$("#change32Btn").attr("disabled",true);
	}
	function change43(){
		var upload = $.trim($("#upload").val());
		if(!upload){
			alert("请选择要上传的文件");
			return false;
		}
		var suffix = upload.substring(upload.lastIndexOf(".")+1);
		if("xlsx" != suffix){
			alert("请上传后缀名为xlsx的文件");
			return false;
		}
		
		$("#batchFreezeImportForm").attr("action","<%=basePath%>/change32And43/importChange43List.ct");
		$("#batchFreezeImportForm").submit();
		$("#change43Btn").attr("disabled",true);
	}
	
</script>
</head>

<body>
<table class="tb">
	<tbody>
		<s:form id="batchFreezeImportForm" method="post" theme="simple" enctype="multipart/form-data">
		<input id="dealType" type="hidden" name="dealType" />
			<tr class="tb-line">
				<td class="tb-td" colspan="6"><div class="tb-h2">POS收单运营管理平台</div>
					<font color="red">提示：仅支持 EXCEL-2007及以上版本，请在表格备注列标明"冻结、解冻、注销、开通"原因</font>
					<br>
					<input id="showMouldBtn" type="button" onclick="showMould();" value="显示/隐藏商户批量操作导入文件模板" />
					<div id="upFileExp" style="display:none">
						<table border="1" width="40%" style="color: red;font-size: 10px" bordercolor="red">
							<tr >
								<td align="center"  style="width: 50%">商户号</td>
								<td align="center"  style="width: 50%">备注</td>
							</tr>
							<tr >
								<td align="center">850*************</td>
								<td align="center">操作原因</td>
							</tr>
						</table>	
	                 </div>
				</td>
			</tr>
			<tr class="tb-line bg-gray">
				<td class="tb-td"  colspan="6"><div class="tb-h3">商户批量操作</div></td>
			</tr>
			<tr class="tb-line">
				<td colspan="3" align="center"><span style="font-color: red"><s:actionerror /></span>
				<%-- <span style="font-color: red;"><s:actionmessage /></span > <span style="font-color: red;"> --%>
				<s:fielderror cssClass="fieldError" /></span><span id="otherError"></span>
				</td>
			</tr>
			
			<tr class="tb-line">
				<td width="12%" style="min-width: 100px" align="center" class="tb-td">
					<div class="tb-h4">请选择文件：</div>
				</td>
				<td align="center">
					<s:file id="excelFile" name="excelFile"></s:file>
				</td>
				<td class="tb-td line-submit" style="min-width: 250px;text-align: left;" colspan="2">									
					<label class="tb-input-submit">
						<input type="button" id="imptFrzeMerinfoBtn" onclick="freezeImportSubmit('0');" value="冻结商户"/>
					</label>
				</td>	
				<td class="tb-td line-submit" style="min-width: 250px;text-align: left;" colspan="2">									
					<label class="tb-input-submit">
						<input type="button" id="imptUnFrzeMerinfoBtn" onclick="freezeImportSubmit('1');" value="解冻商户"/>
					</label>
				</td>
			</tr>
			<tr class="tb-line">
				<td width="12%" style="min-width: 100px" align="right" class="tb-td">
					<div class="tb-h4"></div>
				</td>
				<td align="center">
				</td>
				<td class="tb-td line-submit" style="min-width: 250px;text-align: left;" colspan="2">									
					<label class="tb-input-submit">
						<input type="button" id="imptportCalMerinfoBtn" onclick="freezeImportSubmit('2');" value="注销商户"/>
					</label>
				</td>
				<td class="tb-td line-submit" style="min-width: 250px;text-align: left;" colspan="2">									
					<label class="tb-input-submit">
						<input type="button" id="imptportCalMerinfoBtn" onclick="freezeImportSubmit('3')" value="开通商户"/>
					</label>
				</td>
			</tr>
			<tr class="tb-line">
				<td class="tb-td" colspan="6"><div class="tb-h3"></div></td>
			</tr>
			
			<tr class="tb-line bg-gray">
				<td class="tb-td" colspan="6"><div class="tb-h3">变更商户32域或43域</div></td>
			</tr>
			
			<tr class="tb-line">
				<td width="12%" style="min-width: 100px" align="center" class="tb-td">
					<div class="tb-h4">请选择文件：</div>
				</td>
				<td align="center">
					<s:file id="upload" name="file"></s:file>
				</td>
				<%-- <td class="tb-td">
					<label>
						<s:file id="upload" name="file"  ></s:file>
					</label>
				</td>
 --%>				<td class="tb-td line-submit" style="min-width: 350px;text-align: left;" colspan="2">									
					<label class="tb-input-submit">
						<input type="button" id="exportBtn" onclick="change32();" value="变更32域"/>
					</label>
				</td>					
				<td class="tb-td line-submit" style="min-width: 350px;text-align: left;" colspan="2">									
					<label class="tb-input-submit">
						<input type="button" id="exportBtn" onclick="change43();" value="变更43域"/>
					</label>
				</td>					
			</tr>
			
			
			<tr>
				<td class="tb-td" colspan="6" align="center"><span style="color: red"><s:actionerror /></span>
						<span style="color: red"> <s:actionmessage /></span> 
						<spanstyle="color: red;"><s:fielderror cssClass="fieldError" /></span> 
						<span id="otherError" style="color: red"></span>
				</td>
			</tr>

			<tr>
				<td colspan="4">&nbsp;<s:token></s:token></td>
			</tr>
			<tr>
				<td colspan="4">&nbsp;<s:token></s:token></td>
			</tr>
				
				
			<tr>
				<td colspan="4" style="color:blue;" >
				<font size ="2">
				提示:<br/>
				
				&nbsp;&nbsp;1： 商户批量操作和变更商户32域或43域为2个不同操作。<br/>
				&nbsp;&nbsp;2： 导入文件为excel且后缀为xlsx。<br/>
				&nbsp;&nbsp;3： 变更时导入的文件只能存在2列,第一行为"商户号"三个汉字,下面为商户号,商户号的长度为15位。<br/>
				&nbsp;&nbsp;4：第一行第二列应为"变更32域"或"变更43域"五个字,下面为所对应信息。<br/>
				&nbsp;&nbsp;</font>

				</td>
			</tr>
		</s:form>
	</tbody>
</table>
</body>
	<s:if test="#request.msg !=null">
		<script language="javascript">
			alert("${request.msg}");
		</script>
	</s:if>
</html>